Skip to content

fix: resolve flight search error handling issues (#274, #275)#446

Open
kristinemejia443-netizen wants to merge 1 commit into
etherisc:developfrom
kristinemejia443-netizen:claude/fix-flight-search-errors
Open

fix: resolve flight search error handling issues (#274, #275)#446
kristinemejia443-netizen wants to merge 1 commit into
etherisc:developfrom
kristinemejia443-netizen:claude/fix-flight-search-errors

Conversation

@kristinemejia443-netizen

Copy link
Copy Markdown

Summary

This PR addresses 6 root-cause bugs in the flight search data flow that produced misleading or incorrect error messages:

  1. proxy.ts — axios had zero error handling; any 4xx/5xx from Flightstats became an unhandled rejection → Next.js 500 → COMM_ERROR → generic "No matching flight found". Now properly forwards Flightstats error responses.
  2. application_error.tsxdefault case lumped COMM_ERROR and INCONSISTENT_DATA into the same "No matching flight found" message. Now shows distinct messages: inconsistent data gets its dedicated message, communication errors get a connectivity error message.
  3. use_flightstats_api.tsxcache: 'force-cache' permanently cached empty/error responses, so a single failed request would show stale errors forever. Changed to no-store.
  4. use_flightstats_api.tsx — No null check on jsonResponse.appendix before accessing .airports, causing a TypeError if Flightstats omits the appendix field.
  5. api_constants.ts — Default fake credentials '123456789' silently masked missing env vars, ensuring all Flightstats requests would fail with confusing errors.
  6. route.ts — No validation on departure date before constructing the Flightstats URL; malformed dates would silently pass through.

Test plan

  • TypeScript syntax verified — all changes use standard, safe patterns
  • Verify proxy forwards Flightstats error responses instead of returning 500
  • Verify distinct error messages display for each error reason: COMM_ERROR, INCONSISTENT_DATA, NO_FLIGHT_FOUND
  • Verify null-safe appendix access doesn't crash when Flightstats omits appendix
  • Verify missing env var warning is logged at startup
  • Verify invalid date format returns 400

🤖 Generated with Claude Code

fix: resolve flight search error handling issues (etherisc#274, etherisc#275)

- Add axios error handling in proxy to forward Flightstats errors instead of crashing with 500
- Distinguish COMM_ERROR, INCONSISTENT_DATA, and NO_FLIGHT_FOUND error messages
- Replace force-cache with no-store to prevent permanent caching of empty/error responses
- Add null check on jsonResponse.appendix to prevent TypeError
- Remove fake default Flightstats credentials (123456789) that silently mask missing env vars
- Validate departure date format in schedule route

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: No matching flight found. [Bug]: An unknown error occurred. Please try again later.

2 participants